/*
 * bspImitativeUart.h
 *
 *  Created on: 2017年9月20日
 *      Author: Administrator
 */

#ifndef BSPUSER_BSPIMITATIVEUART_H_
#define BSPUSER_BSPIMITATIVEUART_H_

#define  V_TXD()		gpio_output_bit_get(GPIOB,GPIO_PIN_15)	
#define  V_TX_HI()		gpio_bit_set(GPIOB,GPIO_PIN_15)
#define  V_TX_LOW()		gpio_bit_reset(GPIOB,GPIO_PIN_15)

#define  V_RXD() 		gpio_input_bit_get(GPIOB,GPIO_PIN_14)
#define  V_RXD_HI()		gpio_bit_set(GPIOB,GPIO_PIN_14)
#define  V_RXD_LOW()	gpio_bit_reset(GPIOB,GPIO_PIN_14)

#define  LED() 			gpio_input_bit_get(GPIOB,GPIO_PIN_13)
#define  LED_HI()		gpio_bit_set(GPIOB,GPIO_PIN_13)
#define  LED_LOW()		gpio_bit_reset(GPIOB,GPIO_PIN_13)
#define  LED_TOGGLE()	LED() ? LED_LOW() : LED_HI()

#define V_UART_SEND_BUF_SIZE    128
typedef struct S_V_UART
{
    uint8_t ucSendBuf[V_UART_SEND_BUF_SIZE];
    uint16_t usSendSize;
}tsVuart;

typedef struct S_V_UART_DATA
{
    uint8_t ucData;
    uint8_t ucCountBit;
    uint16_t usCountByte;
}tsVuartDevice;

typedef enum
{
    V_UART_IDLE,
    V_UART_SEND_START,
    V_UART_SEND_DATA_BIT,
    V_UART_SEND_DATA_BYTE,
}teVuartStatus;

extern void vImitativeUartInit(uint32_t uiBaudRate);
extern void vUartSend(uint8_t *pucBuf, uint16_t usSize);


#endif /* BSPUSER_BSPIMITATIVEUART_H_ */
